import * as api from "./gw";

export default () => {
  var api = window.api
  const shopCode = localStorage.getItem('storeCode')
  const shoreCode = localStorage.getItem('storeCode')
  const storeCode = localStorage.getItem('storeCode')
  const enterpriseId = api.enterpriseId;
  const enterpriseCode = api.enterpriseCode
  const H5_HOST_URL = api.local_host || 'http://njxs.weilian.cn/shoppingCart'
  //基础模块
  const base_host = api.base_host
  //商品模块
  const goods_host = api.goods_host
  //交易模块
  const trade_host = api.trade_host
  //主页信息模块
  const home_commend = api.home_commend
  //服务模块
  const service_host = api.service_host
  //获取购物车相关的配置
  const getConfig  =  base_host + '/common/selectCommonConfig' + '/' +enterpriseCode
  //获取商品列表
  const goodsList = goods_host + '/mallGoods/queryMallGoodsList'
  //获取分类信息
  const classList = goods_host + '/goodsClass/queryGoodsclassInfo?enterpriseCode=' + enterpriseCode + '&storeCode=' + shoreCode
  //获取可售后订单列表
  const getOrderUrl = trade_host + "/orderCanAfterSales/OrderGoodsList"
  //获取已售后订单列表
  const getSubmitedInfor = service_host + "/afterSales/selectAfterSalesList"
  //分页查找售后列表
  const selectAfterSalesPageList = service_host + '/afterSales/selectAfterSalesPageList'
  //删除购物车内的商品
  const deleteShoppingCart = trade_host + '/shopCart/delete/'
  //删除购物车内的商品
  const addShoppingCart = trade_host + '/shopCart/add'
  const updateShoppingCart = trade_host + '/shopCart/updateGoodsInfo'
  const queryShoppingCart = trade_host + '/shopCart/select'
  const queryShoppingCartForCart = trade_host + '/shopCart/getShopCart'
  const scanDeleteShoppingCart = trade_host + '/scanCodeShopCart/delete/'
  const scanAddShoppingCart = trade_host + '/scanCodeShopCart/add'
  const scanUpdateShoppingCart = trade_host + '/scanCodeShopCart/updateGoodsInfo'
  const scanQueryShoppingCart = trade_host + '/scanCodeShopCart/select'
  const scanQueryShoppingCartForCart = trade_host + '/scanCodeShopCart/getShopCart'

  //H5_HOST_URL + "/shoppingCart/queryShoppingCart"
  const queryDiscount = H5_HOST_URL + "/couponManagement/getvouchermesslist?enterpriseid=" + enterpriseId + '&'
  const queryUserInfo = H5_HOST_URL + "/user/getUserInfo?"

  const queryPromotionInfo = trade_host + '/marketCenter/getCalCart/' + shoreCode + '/' + false
  const queryPromotionInfoOffLine = trade_host + '/marketCenter/getCalCartNoLogin'
  const scanQueryPromotionInfo = trade_host + '/marketCenter/getCalScanCodeCart/' + shoreCode + '/' + false


  const queryRegularDetail = trade_host + '/marketCenter/getUsableRegularList/' + enterpriseCode
  const queryFixedDetail = trade_host + '/marketCenter/getFixedPackage/' + enterpriseCode
  const takeDiscount = trade_host + '/marketCenter/receiveCouponCodesOnline'
  const takeDiscountOffLine = trade_host + '/marketCenter/receiveCouponCodesOffline'

  return {
    getConfig,
    goods_host,
    home_commend,
    enterpriseCode,
    shoreCode,
    shopCode,
    goodsList,
    storeCode,
    classList,
    H5_HOST_URL,
    Confirm,
    getOrderUrl,
    getSubmitedInfor,
    getServiceOrderInfor,
    enterpriseId,
    deleteShoppingCart,
    addShoppingCart,
    updateShoppingCart,
    queryShoppingCart,
    queryShoppingCartForCart,
    queryDiscount,
    queryUserInfo,
    queryPromotionInfo,
    queryPromotionInfoOffLine,
    queryRegularDetail,
    queryFixedDetail,
    takeDiscount,
    scanDeleteShoppingCart,
    scanAddShoppingCart,
    scanUpdateShoppingCart,
    scanQueryShoppingCart,
    scanQueryShoppingCartForCart,
    scanQueryPromotionInfo,
    takeDiscountOffLine,
    selectAfterSalesPageList
  }
}

